package com.example.demo;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;


/*
 *
 *
 *
 *
 */

@WebServlet("/pageHitCounter")
public class PageHitCounter extends HttpServlet {


    private int hitCount;

    public void init() throws ServletException {
        hitCount=0;
    }

    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter writer= resp.getWriter();
        hitCount+=1;
        writer.println("count========   "+hitCount);
    }



    public void destroy() {

    }
}
